<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: xiao
  Date: 2020/12/13
  Time: 19:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

</head>
<body>
<script src="${pageContext.request.contextPath}/js/jquery-3.5.1.js"></script>
<h1><span class="label label-default">预约列表</span></h1>
<table class="table table-hover table-striped">

    <%--               书籍从数据库查询出来，从这个list遍历出来--%>

    <table class="table table-hover table-striped">
        <thead>
        <tr>

            <th>预约编号</th>
            <th>书籍编号</th>
            <th>书籍名称</th>
            <th>学生学号</th>
            <th>学生姓名</th>
            <th>预约时间</th>
            <th>预约状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <%--               书籍从数据库查询出来，从这个list遍历出来--%>

        <tbody>
        <c:forEach var="appointmentList" items="${appointmentList}">

            <tr>
                <td> ${appointmentList.aid}</td>
                <td> ${appointmentList.bid}</td>
                <td>${appointmentList.bname}</td>
                <td>${appointmentList.sno}</td>
                <td>${appointmentList.sname}</td>
                <td>${appointmentList.adate}</td>
                <td>
                    <c:if test="${appointmentList.state ==0}"><span style="color: #00FF00">处理中</span></c:if>
                    <c:if test="${appointmentList.state ==1}"><span style="color: #e2b617">已准备完成</span></c:if>
                </td>

                <td> <c:if test="${appointmentList.state==0}" >  <a href="${pageContext.request.contextPath}/appointment/changeState?aid=${appointmentList.aid}&state=1"><button class="btn btn-info">准备完毕</button></a></c:if>
                    <c:if test="${appointmentList.state==1}" >  <a href="${pageContext.request.contextPath}/appointment/borrow-admin?bookID=${appointmentList.bid}&bookName=${appointmentList.bname}&sno=${appointmentList.sno}&sname=${appointmentList.sname}&aid=${appointmentList.aid}"><button class="btn btn-info">已完成借阅</button></a></c:if>

                </td>


            </tr>
        </c:forEach>
        </tbody>
    </table>

</table>
</body>
</html>
